import {Map} from 'immutable'
import * as actionTypes from './constants'
const defaultState = Map({
  hotAlbums: [],
  allAlbums: [],
  allCount: 0,
  albumDetail: {},
  albumSongs: [],
  albumComments: [],
  commentsCount: 0
})
export default function reducer(state = defaultState, action) {
  switch (action.type) {
    case actionTypes.CHANGE_HOT_ALBUM_ACTION:
      return state.set('hotAlbums', action.hotAlbums)
    case actionTypes.CHANGE_ALL_ALBUM_ACTION:
      return state.set('allAlbums', action.allAlbums)
    case actionTypes.CHANGE_ALL_COUNT_ACTION:
      return state.set('allCount', action.allCount)
    case actionTypes.CHANGE_ALBUM_DETAIL_ACTION:
      return state.set('albumDetail', action.albumDetail)
    case actionTypes.CHANGE_ALBUM_SONGS_ACTION:
      return state.set('albumSongs', action.albumSongs)
    case actionTypes.CHANGE_ALBUM_COMMENTS_ACTION:
      return state.set('albumComments', action.albumComments)
    case actionTypes.CHANGE_ALBUM_COMMENTS_COUNT_ACTION:
      return state.set('commentsCount',action.commentsCount)
    default:
      return state
  }
}